<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<f:view>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Nova Viagem</title>
	</head>
	<body>
	<a4j:form>
	<rich:panel>
		
		<h:panelGrid columns="2">
			<rich:messages />
			<rich:spacer/>
			
			<h:outputText value="País: " />
			<h:selectOneMenu id="pa"  value="#{rankingAction.travel.city.country.id}" >
				<f:selectItems value="#{countryAction.listCountry}"/>
				<a4j:support event="onchange" reRender="cid" actionListener="#{rankingAction.processCityByCountry}"/>
			</h:selectOneMenu> 
			
			<h:outputText value="Cidade: " />
			<h:selectOneMenu id="cid"  value="#{rankingAction.travel.city.id}"  >
				<f:selectItems value="#{rankingAction.listCityByCountry}"/>
			</h:selectOneMenu>

			<h:outputText value="Nota: " />
			<h:selectOneMenu id="no" value="#{rankingAction.travel.rank}" >
				<f:selectItems value="#{rankingAction.listRankValues}"/>
			</h:selectOneMenu>
			
			<h:outputText value="Impressões: " />
			<h:inputTextarea id="im" value="#{rankingAction.travel.opinion}" requiredMessage="Informe suas Impressões sobre a Viagem"/>

			<a4j:commandButton value="Limpar campos" 
				action="#{rankingAction.cleanFields}" reRender="pa,cid,no,im"/>
			<h:commandButton value="Adicionar viagem"
				action="#{rankingAction.add}" />
			<h:commandButton value="Cancelar"
				action="#{rankingAction.cleanAndList}" />

		</h:panelGrid>
		</rich:panel>
	</a4j:form>
	</body>
</f:view>
</html>